import {
	https
} from './https.js'; // 引入刚刚封装好的https
class api {
	//获取用户配置
	async launch(data) {
		return await https({
			url: 'api/launch',
			method: 'get',
			data

		})
	}
	// 匹配初始化
	async match(data) {
		const res = await https({
			url: 'api/match',
			method: 'post',
			data
		})
		return res
	}
	// 退出登录----
	async logout() {
		const res = await https({
			url: 'api/user/logout',
			method: 'post',

		})
		return res
	}
	// 绑定手机号----
	async bindPhone(data) {
		const res = await https({
			url: 'api/user/phone',
			method: 'post',
			data

		})
		return res
	}
	// 错误上报
	async errorReport() {
		const res = await https({
			url: 'api/error/report',
			method: 'post',

		})
		return res
	}
	// 苹果支付回调
	async applePay(data) {
		const res = await https({
			url: 'api/order/apple',
			method: 'post',
			data
		})
		return res
	}
	// 发送手机验证码
	async smsSend(data) {
		const res = await https({
			url: 'api/sms/send',
			method: 'post',
			data
		})
		return res
	}
	// 登录
	async phonelogin(data) {
		const res = await https({
			url: 'api/user/login',
			method: 'post',
			data,
		})
		return res
	}
	// 获取session_key
	async getSession(data) {
		const res = await https({
			url: 'api/user/session',
			method: 'get',
			data,
		})
		return res
	}
	// 用户登录后的信息
	async getUserInfo(data) {
		const res = await https({
			url: 'api/user',
			method: 'get',
			data
		})
		return res
	}
	// 修改用户信息
	async userInfoChange(data) {
		const res = await https({
			url: 'api/user',
			method: 'put',
			data
		})
		return res
	}
	// 记录用户点击事件（埋点）
	async userEvent(data) {
		const res = await https({
			url: 'api/user/event',
			method: 'post',
			data
		})
		return res
	}
	// 更改用户头像
	async changeAvater(data) {
		const res = await https({
			url: 'api/base/upload',
			method: 'post',
			data
		})
		return res
	}


	// 浏览记录
	async getBrowseRecord(data) {
		const res = await https({
			url: 'api/user/yic/foot',
			method: 'get',
			data
		})
		return res
	}
	// 获取会员开通信息
	async getGoods(data) {
		const res = await https({
			url: 'api/goods',
			method: 'get',
			data
		})
		return res
	}
	// 创建订单
	async createOrder(data) {
		const res = await https({
			url: 'api/order',
			method: 'post',
			data
		})
		return res
	}
	async orderNewly(data) {
		const res = await https({
			url: 'api/order/newly',
			method: 'get',
			data
		})
		return res
	}
	//获取开票订单
	async getOrder(data) {
		const res = await https({
			url: 'api/order',
			method: 'get',
			data
		})
		return res

	}
	//创建开票订单
	async createInvoiceOrder(data) {
		const res = await https({
			url: 'api/order/invoice',
			method: 'post',
			data
		})
		return res
	}

	/*
	 *
	 *	定位管理
	 * 
	 */
	//订单状态查询
	async getOrderStatus(data) {
		const res = await https({
			url: 'api/order/status',
			method: 'get',
			data
		})
		return res
	}
	// 获取文章列表
	async getArticle(data) {
		const res = await https({
			url: 'api/article',
			method: 'get',
			data
		})
		return res
	}
	// 获取文章类型列表
	async getArticleType(data) {
		const res = await https({
			url: 'api/article/type',
			method: 'get',
			data
		})
		return res
	}
	// 获取专题列表
	async getTopic(data) {
		const res = await https({
			url: 'api/special/topic',
			method: 'get',
			data
		})
		return res
	}
	// 获取合同类型列表
	async getContractType(data) {
		const res = await https({
			url: 'api/contract',
			method: 'get',
			data
		})
		return res
	}
	// 获取合同文件列表
	async getContractFile(data) {
		const res = await https({
			url: 'api/contract/file',
			method: 'get',
			data
		})
		return res
	}
	// 获取撰写记录
	async legalInstrument(data) {
		const res = await https({
			url: 'api/legal/instrument',
			method: 'get',
			data
		})
		return res
	}
	// 删除撰写记录
	async delInstrument(data) {
		const res = await https({
			url: `api/legal/instrument?docId=${data.docId}`,
			method: 'delete',
			data
		})
		return res
	}
	// 获取合同文件列表
	async legalLitigation(data) {
		const res = await https({
			url: 'api/legal/writing',
			method: 'post',
			data
		})
		return res
	}
	// 新增审核列表
	async contractView(data) {
		const res = await https({
			url: 'api/contract/review',
			method: 'post',
			data
		})
		return res
	}
	// 获取审查记录
	async getContractView(data) {
		const res = await https({
			url: 'api/contract/review',
			method: 'get',
			data
		})
		return res
	}
	// 删除审查记录
	async delReviewRecord(data) {
		const res = await https({
			url: `api/contract/review?contractId=${data.contractId}`,
			method: 'delete',
			data
		})
		return res
	}
	// 查看审查详情
	async getReviewDetail(data) {
		const res = await https({
			url: `api/contract/review/detail`,
			method: 'get',
			data
		})
		return res
	}
	// 获取AI回答流式
	async chatStream(data) {
		const res = await https({
			url: 'api/chat/stream',
			method: 'post',
			data
		})
		return res
	}
	// 获取AI回答
	async chat(data) {
		const res = await https({
			url: 'api/chat',
			method: 'post',
			data
		})
		return res
	}

}
export default new api()